/*
 * Copyright (C), 2002-2014, 
 * FileName: //文件名
 * Author:   Administrator
 * Date:     2014年12月19日 下午3:57:49
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.deco.back.controller.system;

import javax.servlet.http.HttpServletRequest;

import com.deco.domain.vo.sys.CmsMenuVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.deco.domain.vo.brand.BrandStoryVo;
import com.deco.service.brand.BrandStoryService;
import com.deco.service.sys.CmsMenuService;
import com.free.common.vo.PageResponseVo;
import com.free.common.vo.PageSearchVo;
import com.free.common.vo.ResultModel;
import com.free.ext.web.spring.annoation.PageSearch;

/**
 * 品牌故事Controller
 * 
 * @author xxg
 */
@Controller
public class CmsMenuController {

    @Autowired
    private CmsMenuService cmsMenuService;

    /**
     * View视图
     */
    @RequestMapping(value="/cms_menu_list.do")
    public ModelAndView brandstoryList() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("system/cmsmenulist");
        return modelAndView;
    }

    @RequestMapping(value = "/cms_menu_tree.do")
    @ResponseBody
    public ResultModel cmsMenus(Integer parentId) {
        return ResultModel.success(cmsMenuService.getTreeMenuByParentId(parentId));
    }

    @RequestMapping(value = "/cms_role_menu_tree.do")
    @ResponseBody
    public ResultModel roleMenus(Integer roleId){
        return ResultModel.success(cmsMenuService.getRoleTreeMenus(roleId));
    }


    @RequestMapping(value="/cms_menu_edit.do")
    @ResponseBody
    public ResultModel addMenuInfo(CmsMenuVo menuVo){
        return cmsMenuService.update(menuVo);
    }

    @RequestMapping(value="/cms_menu_del.do")
    @ResponseBody
    public ResultModel delete(Integer key) {
        return cmsMenuService.delete(key);
    }

}
